﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using ImageMagickNET;
using ClientLibrary;

namespace DocumentDigitalization
{
    public partial class FormMain : Form
    {
        SystemState Systemstate;

        public FormMain(SystemState ss)
        {
            InitializeComponent();
            this.Systemstate = ss;
            this.userControl_MainPage1.setForm(this);
            this.userControl_MainPage1.setSystemState(this.Systemstate);
            
            this.Text = "Document Digitalizer Standalone - Current batch:" + Systemstate.LastBatch.ToString();
            
            // if the client runs at first time
            if (this.Systemstate.FirstRun)
            {
                MessageBox.Show("This is the first run of the application. Please open the settings panel and set the parameters.", "First run hint.");                
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

            
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void exportTypeAndPathToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Settings_Form settings_form = new Settings_Form(this.Systemstate);
            settings_form.ShowDialog();
        }

        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Systemstate.FirstRun = false;
            this.Systemstate.SaveStateToXML();
            this.Systemstate.DeleteTemporaryImageFiles();
        }

        private void listView_images_files_MouseClick(object sender, MouseEventArgs e)
        {
            
        }

        private void templatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_Templates form_templates = new Form_Templates(this.Systemstate);
            form_templates.ShowDialog();
        }

        private void documentsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_Documents form_documents = new Form_Documents();
            form_documents.ShowDialog();
        }

        private void FormMain_Enter(object sender, EventArgs e)
        {
            
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click_1(object sender, EventArgs e)
        {

        }
    }
}
